# -*- coding:utf-8 -*-
from pydantic import Field
from sqlalchemy import Column, Integer, String, DateTime, Enum, DECIMAL, Float, TEXT
from core.curd import Base, TimestampMixin
from pydantic import BaseModel
class SysParam(Base, TimestampMixin):
    """
    参数配置表
    """
    __tablename__ = 'sys_param'

    id = Column(Integer, primary_key=True, autoincrement=True, comment='参数主键')
    param_name = Column(String(100), nullable=True, default='', comment='参数名称')
    param_key = Column(String(100), nullable=True, default='', comment='参数键名')
    param_value = Column(String(500), nullable=True, default='', comment='参数键值')
    param_type = Column(String(1), nullable=True, default='N', comment='系统参数 0：否 1：是')


class CreateSysParam(BaseModel):
    param_key: str = Field(comment='参数键名', max_length=100)
    param_name: str = Field(comment='参数名称', max_length=100)
    param_value: str = Field(comment='参数键值', max_length=500)
    param_type: int = Field(comment="排序", default=0)


class UpdateSysParam(BaseModel):
    id: int = Field(comment='id')
    param_key: str = Field(comment='参数键名', max_length=100)
    param_name: str = Field(comment='参数名称', max_length=100)
    param_value: str = Field(comment='参数键值', max_length=500)
    param_type: int = Field(comment="排序", default=0)
